import request from '@/utils/request'

//获得spu列表的数据
export const reqSpuList = (page, limit, category3Id) => request({ url: `/admin/product/${page}/${limit}`, method: 'get', params: { category3Id } })

//获得spu信息
export const reqSpu = (spuId) => request({ url: `/admin/product/getSpuById/${spuId}`, method: 'get' })
//获得品牌的信息
export const reqTradeMarkList = () => request({ url: `/admin/product/baseTrademark/getTrademarkList`, method: 'get' })
//获得SPU图标的信息
export const reqSpuImageList = (spuId) => request({ url: `/admin/product/spuImageList/${spuId}`, method: 'get' })
//获得平台全部的销售属性---整个平台销售属性一共3个
export const reqBaseSaleAttrList = () => request({ url: '/admin/product/baseSaleAttrList', method: 'get' })
export const reqAddOrUpdataSpuInfo = (spuInfo) => {
    if (spuInfo.id) {
        return request({ url: `/admin/product/updateSpuInfo`, data: spuInfo, method: 'post' })
    }
    else {
        return request({ url: `/admin/product/saveSpuInfo`, data: spuInfo, method: 'post' })
    }
}
//删除spuInfo请求
export const reqDeleteSpu = (spuId) => request({ url: `/admin/product/deleteSpu/${spuId}`, method: 'delete' })




// 获得图片的数据
export const reqSpuImagesList = (spuId) => request({ url: `/admin/product/spuImageList/${spuId}`, method: "get" })
//获得销售属性的数据
export const reqSpuSaleList = (spuId) => request({ url: `/admin/product/spuSaleAttrList/${spuId}`, method: "get" })
//获得平台属性的数据
export const reqAttrInfoList = (category1Id, category2Id, category3Id) => request({ url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`, method: "get" })
//保存SKU
export const reqAddSku = (skuInfo) => request({ url: `/admin/product/saveSkuInfo`, method: 'post', data: skuInfo })

//获得sku列表展示的数据
export const reSkuList = (spuId) => request({ url: `/admin/product/findBySpuId/${spuId}`, method: 'get' })

